package net.wanho.client;

import net.wanho.config.MyLoadBalancerConfig;
import net.wanho.entity.User;
import net.wanho.vo.AjaxResult;
import org.springframework.cloud.loadbalancer.annotation.LoadBalancerClients;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * Author：汤小洋
 * Date：2023-08-02 13:51
 * Description：<描述>
 */
@FeignClient("user-provider")
@LoadBalancerClients(defaultConfiguration = {MyLoadBalancerConfig.class}) // 指定负载均衡配置
public interface UserClient {

    @GetMapping("/users/test")
    public String test();

    @GetMapping("/users")
    public AjaxResult list(@RequestParam(value = "username") String username);

    @DeleteMapping("/users/{id}")
    public AjaxResult removeById(@PathVariable("id") int id);

    @PostMapping("/users")
    public AjaxResult add(@RequestBody User user);

    @PutMapping("/users")
    public AjaxResult modify(@RequestBody User user);

    @GetMapping("/users/query")
    public AjaxResult query(@RequestParam Map<String,Object> map);

}
